	/*************image**********************/
	function plusReady(){  
                // 弹出系统选择按钮框  
        document.getElementById("imageup").addEventListener('tap',function(){
			page.imgUp();   
		});
		document.getElementById("imageup1").addEventListener('tap',function(){
			page1.imgUp1();  
		});
		 document.getElementById("imageup2").addEventListener('tap',function(){
			page2.imgUp2();   
		});
    }  
	var page=null;
    var page1=null; 
    page={  
        imgUp:function(){  
            var m=this;  
            plus.nativeUI.actionSheet({cancel:"取消",buttons:[  
                {title:"拍照"},  
                {title:"从相册中选择"}  
            ]}, function(e){//1 是拍照  2 从相册中选择  
                        switch(e.index){  
                            case 1:appendByCamera();
                            break;
                            case 2:appendByGallery();
                            break;
                        }  
                    });  
                }  
                //摄像头  
            }   
            // 拍照添加文件
	    function appendByCamera(){
	        plus.camera.getCamera().captureImage(function(e){
	        console.log(e);
	        plus.io.resolveLocalFileSystemURL(e, function(entry) { 
	        var path = entry.toLocalURL(); 
	        document.getElementById("headimg").src = path; 
	        document.getElementById("p").style.display='none';
	    }, function(e) { 
	       		mui.toast("读取拍照文件错误：" + e.message); 
	       		}); 
	    
	     	});    
		}
	            // 从相册添加文件
            function appendByGallery(){
                plus.gallery.pick(function(path){
                    document.getElementById("headimg").src = path; 

                });
            }
        /****************************2*************************************/
        page1={  
                imgUp1:function(){  
                    var m=this;  
                    plus.nativeUI.actionSheet({cancel:"取消",buttons:[  
                        {title:"拍照"},  
                        {title:"从相册中选择"}  
                    ]}, function(e){//1 是拍照  2 从相册中选择  
                        switch(e.index){  
                            case 1:appendsByCamera();
                            break;
                            case 2:appendsByGallery();
                            break;
                        }  
                    });  
                }  
                //摄像头  
            }   
            // 拍照添加文件
            function appendsByCamera(){
                plus.camera.getCamera().captureImage(function(e){
                    console.log(e);
                    plus.io.resolveLocalFileSystemURL(e, function(entry) { 
                    var path = entry.toLocalURL(); 
                    document.getElementById("headimg1").src = path; 
                    document.getElementById("p").style.display='none';
                    }, function(e) { 
                        mui.toast("读取拍照文件错误：" + e.message); 
                    }); 
    
                });    
            }
            // 从相册添加文件
            function appendsByGallery(){
                plus.gallery.pick(function(path){
                    document.getElementById("headimg1").src = path; 

                });
            }
             /****************************3*************************************/
        page2={  
                imgUp2:function(){  
                    var m=this;  
                    plus.nativeUI.actionSheet({cancel:"取消",buttons:[  
                        {title:"拍照"},  
                        {title:"从相册中选择"}  
                    ]}, function(e){//1 是拍照  2 从相册中选择  
                        switch(e.index){  
                            case 1:appendssByCamera();
                            break;
                            case 2:appendssByGallery();
                            break;
                        }  
                    });  
                }  
                //摄像头  
            }   
            // 拍照添加文件
            function appendssByCamera(){
                plus.camera.getCamera().captureImage(function(e){
                    console.log(e);
                    plus.io.resolveLocalFileSystemURL(e, function(entry) { 
                    var path = entry.toLocalURL(); 
                    document.getElementById("headimg2").src = path; 
                    document.getElementById("p").style.display='none';
                    }, function(e) { 
                        mui.toast("读取拍照文件错误：" + e.message); 
                    }); 
    
                });    
            }
            // 从相册添加文件
            function appendssByGallery(){
                plus.gallery.pick(function(path){
                    document.getElementById("headimg2").src = path; 

                });
            }
    /***********************提交信息***********************/
   		document.getElementById("option").addEventListener('tap',function(){
   			var account = localStorage.getItem("account");
			var name = document.getElementById('name').value; 
			var IDCard = document.getElementById('IDCard').value; 
			var typeCard = document.getElementById('typeCard').value; 
			var bankCard = document.getElementById('bankCard').value; 
			var _data = {
				account:account,
		  	 	cardNo:bankCard,
		  	  	username:name,
		    	cardType:typeCard,
				idCardNo:IDCard,
		   		idCardFrontUrl:files,
				idCardBackUrl:files1,
				cardImgUrl:files2	
			};
			console.log(_data)
			/*jQuery.ajax({
				type:'post',
				url:server.stockOAccount,
				data:_data,
				beforeSend:function(){
					console.log(data);
				},
				success:function(result){
					console.log(result);
				},
				error:function(result){
					console.log(result);
				}
			})*/
			/*mui.ajax('',{
			        data:{
			            account:account,
				  	 	cardNo:bankCard,
				  	  	username:name,
				    	cardType:typeCard,
						idCardNo:IDCard,
				   		idCardFrontUrl:files,
						idCardBackUrl:files1,
						cardImgUrl:files2
			            },
			            dataType:'json',//数据格式类型
			            type:'POST',//http请求类型
			            timeout:10000,//超时设置
			            success:function(data){
			                       //处理成功返回的数据
			                       alert(12);
			                console.log(JSON.stringify(data));
			             	
			            }
			   })*/
		});
            //服务端接口路径
            var server = "http://www.test.cn/aaa.php";
            //获取图片元素
            var files = document.getElementById('headimg');
            // 上传文件
            function upload(){
                console.log(files.src);
                var wt=plus.nativeUI.showWaiting();
                var task=plus.uploader.createUpload(server,
                    {method:"POST"},
                    function(t,status){ //上传完成
                        if(status==200){
                            alert("上传成功："+t.responseText);
                            wt.close(); //关闭等待提示按钮
                        }else{
                            alert("上传失败："+status);
                            wt.close();//关闭等待提示按钮
                        }
                    }
                );
                //添加其他参数
                task.addData("name","test");
                task.addFile(files.src,{key:"dddd"});
                task.start();
            }  
            if(window.plus){  
                plusReady();  
            }else{  
                document.addEventListener("plusready",plusReady,false);  
            } 